package com.wzh.test.leetcode;

/**
 * 给一个数组[0,1,2,3,5,6]
 * 求丢失的数字4
 */
public class findMissingNum {
    public static void main(String[] args) {
        int[] arrNums = {0,1,2,3,5,6};
        int missingNum = -1;
        for(int i = 1; i < arrNums.length;i++){
            if(arrNums[i] != arrNums[i-1] + 1){
                missingNum = arrNums[i-1] + 1;
                break;
            }
        }
        System.out.println("丢失的数字是:" + missingNum);
    }
}
